package fr.inserm.u674.chcdbweb.model.DTO;

import java.util.Date;

public class EAVVariable {

	private Long variableID;
	private String variableName;
	private String humanReadableName;
	private String dataType;
	private Date creationDate;
	private String description;
	private Boolean deprecated;
	private String nameAlias;

	private int nModalities;

	public EAVVariable() {
	}

	public EAVVariable(Long variableID) {
		this.variableID = variableID;
	}

	public EAVVariable(String variableName) {
		this.variableName = variableName;
	}

	public EAVVariable(Long variableID, String variableName, String humanReadableName,
		String dataType, Date creationDate, String description, Boolean deprecated, String nameAlias) {
		this.variableID = variableID;
		this.variableName = variableName;
		this.humanReadableName = humanReadableName;
		this.dataType = dataType;
		this.creationDate = creationDate;
		this.description = description;
		this.deprecated = deprecated;
		this.nameAlias = nameAlias;
	}

	public EAVVariable(Long variableID, String variableName, String humanReadableName,
		String dataType, String description, Boolean deprecated, String nameAlias) {
		this.variableID = variableID;
		this.variableName = variableName;
		this.humanReadableName = humanReadableName;
		this.dataType = dataType;
		this.description = description;
		this.deprecated = deprecated;
		this.nameAlias = nameAlias;
	}

	public EAVVariable(String variableName, String humanReadableName,
		String dataType, String description, Boolean deprecated, String nameAlias) {
		this.variableName = variableName;
		this.humanReadableName = humanReadableName;
		this.dataType = dataType;
		this.description = description;
		this.deprecated = deprecated;
		this.nameAlias = nameAlias;
	}

	public EAVVariable(String variableName, String humanReadableName,
		String dataType, String description, Boolean deprecated) {
		this.variableName = variableName;
		this.humanReadableName = humanReadableName;
		this.dataType = dataType;
		this.description = description;
		this.deprecated = deprecated;
	}

	public Long getVariableID() {
		return variableID;
	}

	public void setVariableID(Long variableID) {
		this.variableID = variableID;
	}

	public String getVariableName() {
		return variableName;
	}

	public String getName() {
		return getVariableName();
	}

	public void setVariableName(String variableName) {
		this.variableName = variableName;
	}

	public String getHumanReadableName() {
		return humanReadableName;
	}

	public void setHumanReadableName(String humanReadableName) {
		this.humanReadableName = humanReadableName;
	}

	public String getDataType() {
		return dataType;
	}

	public void setDataType(String dataType) {
		this.dataType = dataType;
	}

	public Date getCreationDate() {
		return creationDate;
	}

	public void setCreationDate(Date creationDate) {
		this.creationDate = creationDate;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Boolean getDeprecated() {
		return deprecated;
	}

	public void setDeprecated(Boolean deprecated) {
		this.deprecated = deprecated;
	}

	public String getNameAlias() {
		return nameAlias;
	}

	public void setNameAlias(String nameAlias) {
		this.nameAlias = nameAlias;
	}

	public int getnModalities() {
		return nModalities;
	}

	public void setnModalities(int nModalities) {
		this.nModalities = nModalities;
	}

	public String toString() {
		return variableName;
	}

	public boolean equals(Object obj) {
		if (obj instanceof EAVVariable
			&& ((EAVVariable) obj).getVariableName().equals(variableName)) {
			return true;
		}
		return false;
	}

	public boolean hasSameDatatypeAs(EAVVariable var) {
		boolean result = false;
		if (var.getDataType() == dataType)
			result = true;
		return result;
	}

	public int hashCode() {
		if (getVariableName() != null)
			return this.getClass().hashCode() + getVariableName().hashCode();
		else
			return super.hashCode();
	}
}
